#include <CmdLine.h>
#include "xtprobeImageDiskXFile.h"
#include "tp2.h"
using namespace Torch;


int main(int argc, char **argv){

   	char* nomFichier;
	
	//nom de l'histogramme
	char histoName[] = {'_','h','i','s','t','o','.','p','p','m','\0'};
	
	char fonction_name[] = {'_','f','o','n','c','t','i','o','n','t','r','a','n','s','f','.','p','p','m','\0'};
    	CmdLine cmd;
	int *x1,*y1,*x2,*y2,*x3,*y3,*x4,*y4;

	if(argc<6 || argc == 7 || argc == 9 || argc > 10)
		exit(0);

	x1 = (int*)malloc(sizeof(int)*1);
	y1 = (int*)malloc(sizeof(int)*1);
	x2 = (int*)malloc(sizeof(int)*1);
	y2 = (int*)malloc(sizeof(int)*1);
	x3 = (int*)malloc(sizeof(int)*1);
	y3 = (int*)malloc(sizeof(int)*1);
	x4 = (int*)malloc(sizeof(int)*1);
	y4 = (int*)malloc(sizeof(int)*1);	

	nomFichier = (char*)Contraste::readData(argv,nomFichier,x1,y1,x2,y2,x3,y3,x4,y4,argc);

	Contraste *contraste = new Contraste(nomFichier);

	contraste->drawHistogramme(contraste->image,histoName);
		
	contraste->LUT = (int*) contraste->initLUT(*x1,*y1,*x2,*y2,*x3,*y3,*x4,*y4,argc);
	
	contraste->modifyImage(contraste->image);

	contraste->drawFunction(fonction_name,*x1,*y1,*x2,*y2,*x3,*y3,*x4,*y4,argc);

	delete x1; delete y1;delete x2;delete y2;delete x3; delete y3;delete x4;delete y4;
	
    	return (0); 
 }   
  
